package com.shopping.entity;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.FetchType;
import javax.persistence.OneToMany;

import org.hibernate.annotations.CascadeType;

public class Dept implements Serializable {
	private static final long serialVersionUID = 1L;
	     private Integer deptno;
	     private String dname;
	     private String loc;
	    //添加集合，创建对象。
	     private Set<Emp>emps=new HashSet<>();
		public Integer getDeptno() {
			return deptno;
		}
		public void setDeptno(Integer deptno) {
			this.deptno = deptno;
		}
		public String getDname() {
			return dname;
		}
		public void setDname(String dname) {
			this.dname = dname;
		}
		public String getLoc() {
			return loc;
		}
		public void setLoc(String loc) {
			this.loc = loc;
		}
		public static long getSerialversionuid() {
			return serialVersionUID;
		}
		
		@OneToMany(fetch=FetchType.LAZY,cascade=javax.persistence.CascadeType.ALL)
		public Set<Emp> getEmps() {
			return emps;
		}
		public void setEmps(Set<Emp> emps) {
			this.emps = emps;
		}
		@Override
		public String toString() {
			return "Dept [deptno=" + deptno + ", dname=" + dname + ", loc=" + loc + "]";
		}
}